package Time;

import TestSystem.ComputerTestSystem;

import javax.swing.*;


/**
 * Creat with IntelliJ IDEA
 * Description:倒计时类
 * Date:2021-12-14
 * Time:14:07
 */

public class countDown implements Runnable{
    ComputerTestSystem.TestAction listener = new ComputerTestSystem.TestAction();
    public static Timer t;
    public static int time = 2;//20秒倒计时

    public String count() {
        t = new Timer(time*1000,listener);
        t.start();
        while (time > 0) {
            time--;
            try {
                Thread.sleep(1000);
                return ("还剩" + time + "秒");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        return null;
    }


    @Override
    public void run() {

    }
}
